package com.liuqi.openai.model.common;

import java.util.List;

/**
 * 文本生成和聊天模型具有相同的入参的抽象类
 *
 * @author liuqi
 * @date 2025/7/19
 **/
public abstract class AbstractOpenAiChatModel extends AbstractOpenAiModel {

    /* 以下是 本生成和聊天模型 的公共入参 */
    protected Integer maxTokens;
    protected Float temperature;
    protected Float topP;
    protected Integer n;
//    protected Boolean stream;
//    protected StreamOptions streamOptions;
    protected List<String> stop;
    protected Integer seed;
    protected Float presencePenalty;
    protected Float frequencyPenalty;

    protected AbstractOpenAiChatModel(AbstractOpenAiChatModelBuilder builder) {
        super(builder);
        this.maxTokens = builder.maxTokens;
        this.temperature = builder.temperature;
        this.topP = builder.topP;
        this.n = builder.n;
//        this.stream = builder.stream;
//        this.streamOptions = builder.streamOptions;
        this.stop = builder.stop;
        this.seed = builder.seed;
        this.presencePenalty = builder.presencePenalty;
        this.frequencyPenalty = builder.frequencyPenalty;
    }

    public static abstract class AbstractOpenAiChatModelBuilder<B extends AbstractOpenAiChatModel, T extends AbstractOpenAiChatModelBuilder<B, T>>
            extends AbstractOpenAiModelBuilder<B, T> {
        private Integer maxTokens;
        private Float temperature;
        private Float topP;
        private Integer n;
//        private Boolean stream;
//        private StreamOptions streamOptions;
        private List<String> stop;
        private Integer seed;
        private Float presencePenalty;
        private Float frequencyPenalty;
        public T maxTokens(Integer maxTokens) {
            this.maxTokens = maxTokens;
            return (T) this;
        }
        public T temperature(Float temperature) {
            this.temperature = temperature;
            return (T) this;
        }
        public T topP(Float topP) {
            this.topP = topP;
            return (T) this;
        }
        public T n(Integer n) {
            this.n = n;
            return (T) this;
        }
//        public T stream(Boolean stream) {
//            this.stream = stream;
//            return (T) this;
//        }
//        public T streamOptions(StreamOptions streamOptions) {
//            this.streamOptions = streamOptions;
//            return (T) this;
//        }
        public T stop(List<String> stop) {
            this.stop = stop;
            return (T) this;
        }
        public T seed(Integer seed) {
            this.seed = seed;
            return (T) this;
        }
        public T presencePenalty(Float presencePenalty) {
            this.presencePenalty = presencePenalty;
            return (T) this;
        }
        public T frequencyPenalty(Float frequencyPenalty) {
            this.frequencyPenalty = frequencyPenalty;
            return (T) this;
        }
    }

}
